<%@ page import="java.util.Vector" %>
<%@ page import="com.entity.Drug" %>
<%@ page import="com.service.PatientService" %>
<%@ page import="com.entity.Patient" %><%--
  Created by IntelliJ IDEA.
  User: 95241
  Date: 2021/9/22
  Time: 22:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>已开药品单</title>

    <link rel="stylesheet" type="text/css" href="css/deal.css">
</head>
<body style="background-color: #EBECF0">
<br>
<br>

<h2 style="margin-left: 15%">已开药品单</h2>
<br>

<hr align=center width="70%" SIZE=3>
<br>
<br>

<center>
    <table border="1" cellspacing="0" width=70% cellpadding="20">
        <tr bgcolor="#a9a9a9">
            <th align="center">药品单号</th>
            <th align="center">药品名称</th>
            <th align="center">数量</th>
            <th align="center">诊断单号</th>
            <th align="center">病人</th>
        </tr>

        <%
            Vector<Drug> drugs = (Vector<Drug>) request.getAttribute("allDrugs");
            Drug drug;
            PatientService patientService = new PatientService();
            if(drugs!=null){
                int size = drugs.size();
                while (size>0){
                    drug = drugs.get(size-1);
                    Patient patient = patientService.findThisPatient(drug.getAccount());
                    if(drug!=null){
                        %>
        <tr>
            <td align="center"><%=drug.getId()%></td>
            <td align="center"><%=drug.getDrugName()%></td>
            <td align="center"><%=drug.getNumber()%></td>
            <td align="center"><%=drug.getDiagnoseId()%></td>
            <td align="center"><%=patient.getName()%></td>
        </tr>
        <%
                }
                    size-=1;
            }
            }
        %>



    </table>

    <br>
    <br>
    <a href="doctorServlet?skip=mainPage"><input type="button" value="返回" class="sub"></a>
</center>


</body>
</html>
